package com.easymin.daijia.server.gen;

/**
 * @author zhyu
 * @date 2019/12/3 19:02
 * 生成idea插件restfullHttpClient的xml可导入文件的参数部分
 */
public class GenRestFullXml {
    public static String str = "appkey:da21e0b8e1924c6c8e91726d9e8ca74b\n"
        + "orderType:0\n"
        + "passengerPhone:15504760584\n"
        + "lineId:2942\n"
        + "startAddress:天宇大厦内,交通银行(新城支行)附近21米\n"
        + "startLat:42.252038\n"
        + "startLng:118.898940\n"
        + "startTime:1575361512386\n"
        + "endAddress:林西汽车站\n"
        + "endLat:43.604709\n"
        + "endLng:118.07903\n"
        + "lat:42.252039\n"
        + "lng:118.89894\n"
        + "passengerId:5084739\n"
        + "budgetPay:70\n"
        + "memo:\n"
        + "couponId:\n"
        + "peopleNumber:1\n"
        + "takeDeliveryName:\n"
        + "openId:oq4IVv7elL_OywTrPrDI2Hs-0Ndk";

    public static void main(String[] args) {
        String[] split = str.split("\n");
        StringBuilder sb = new StringBuilder();
        sb.append("<list>\n");
        for (String s : split) {
            String[] split1 = s.split(":");
            String key = split1[0];
            String value = "";
            if (split1.length > 1) {
                value = split1[1];
            }
            sb.append("<KeyValuePair>\n"
                + "        <option name=\"key\" value=\"").append(key).append("\" />\n"
                + "        <option name=\"value\" value=\"").append(value).append("\" />\n"
                + "      </KeyValuePair>");
        }
        sb.append("\n"
            + "    </list>");
        System.out.println(sb.toString());
    }
}
